package com.newland.mesdk.demo.interfaceimpl;

import com.newland.mtype.ModuleType;
import com.newland.mtype.module.common.buzzer.Buzzer;
import com.newland.mesdk.demo.moduleinterface.BuzzerInterface;
import com.newland.mesdk.demo.util.ModuleBase;

/**
 * Created by YJF . 蜂鸣器接口实现
 */
public class BuzzerInterfaceImpl extends ModuleBase implements BuzzerInterface {
	private Buzzer buzzer;

	public BuzzerInterfaceImpl() {
		buzzer = (Buzzer) factory.getModule(ModuleType.COMMON_BUZZER);
	}

	//调用蜂鸣器
	@Override
	public void call(int times, int frequence, int pertime, int interval) {
		try {
			buzzer = (Buzzer) factory.getModule(ModuleType.COMMON_BUZZER);
			buzzer.call(times, frequence, pertime, interval);
		} catch (Exception e) {
			System.out.println("蜂鸣器异常" + e);
		}
	}
}
